package com.huosu.filter;

import lombok.extern.slf4j.Slf4j;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * <p>
 * 描述：参数过滤器
 * </p>
 *
 * @author： zhangjian
 * @date： 2020-03-25 10:39:00
 */
@Slf4j
public class ParamsFilter implements Filter {

    @Override
    public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException {
        ParameterRequestWrapper parmsRequest = new ParameterRequestWrapper((HttpServletRequest) arg0);
        try {
            arg2.doFilter(parmsRequest, arg1);
        } catch (ServletException e) {
            log.info(e.getMessage());
        }
    }

    @Override
    public void init(FilterConfig arg0) {

    }

    @Override
    public void destroy() {

    }

}

